<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view('common/head');?>
<body class="no-skin">
<?php $this->load->view('common/header');?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar');?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs');?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set');?>

                <!-- /section:settings.box -->
                <div class="row">
                    <form class="form-inline" action="" method="get">

                        <label class="inline">项目名</label>
                        <input type="text" name="project_name" value="<?php if(isset($key)&&!empty($key)) echo $key;?>" class="form-control" id="project_name">
                        <button type="submit" class="btn btn-info btn-sm" id="submit">
                            <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                            查询
                        </button>
                        <span class="btn btn-warning btn-sm" id="adduser">
                            <span class="ace-icon fa fa-user icon-on-right bigger-110"></span>
                            新增记录
                        </span>
                    </form>

                    <div class="col-xs-12">

                        </div>
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="center">ID</th>
                                <th class="center">项目名称</th>
                                <th class="center">结算金额</th>
                                <th class="center">备注信息</th>
                                <th class="center">结算时间</th>
                                <th class="center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(isset($charges)){ foreach ($charges as $key => $val) { ?>
                                <tr>
                                    <td class="center"><?php echo $val['charge_id']; ?></td>
                                    <td class="center"><?php echo $val['project_name']; ?></td>
                                    <td class="center"><?php echo $val['charge_money']; ?></td>
                                    <td class="center"><?php echo $val['charge_text']; ?></td>
                                    <td class="center"><?php echo date("Y-m-d",$val['charge_time']); ?></td>
                                    <td class="center">
                                        <a style="display:none" href="<?php echo site_url(X_URL.'charge/edit/'.$val['charge_id']);?>">修改</a>&nbsp;
                                        <a style="display:none" class="del" href="javascript:;" val="<?php echo site_url(X_URL.'charge/delete/'.$val['charge_id']);?>" title="删除">删除</a>
                                    </td>
                                </tr>
                            <?php } }?>
                            </tbody>
                        </table>
                        <?php if(isset($pagination)){?><ul class="pagination"><?php echo $pagination;?></ul><?php }?>
<!--                        {$page}-->
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
    </div><!-- /.main-content -->

<?php $this->load->view('common/footer');?>
</div><!-- /.main-container -->

<?php $this->load->view('common/footerjs');?>
<!-- inline scripts related to this page -->
<script type="text/javascript">

    $(function () {
        $("#officialnews ul").html('<div class="ace-icon fa fa-spinner fa-spin orange"></div>');
    })
    $("#adduser").click(function () {
        window.location.href="add";
    });

    $(".del").click(function () {
        var url = $(this).attr('val');
        bootbox.confirm({
            title: "系统提示",
            message: "确定要删除?",
            callback: function (result) {
                if (result) {
                    window.location.href = url;
                }
            },
            buttons: {
                "cancel": {"label": "取消"},
                "confirm": {
                    "label": "确定",
                    "className": "btn-danger"
                }
            }
        });
    });

</script>
</body>
</html>
